﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Configuration;
using System.ServiceModel.Description;
using System.Text;

namespace WooCoo.Client.Wcf
{
    /// <summary>
    /// 客户端终结点行为.
    /// </summary>
    public class ClientEndpointBehavior : BehaviorExtensionElement, IEndpointBehavior
    {
        #region IEndpointBehavior 成员

        public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
        {

        }

        public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
        {
            clientRuntime.MessageInspectors.Add(new ClientMessageInspector());
        }

        public void ApplyDispatchBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher)
        {
        }

        public void Validate(ServiceEndpoint endpoint)
        {
        }

        #endregion


        public override Type BehaviorType
        {
            get { return typeof(ClientEndpointBehavior); }
        }

        protected override object CreateBehavior()
        {
            return new ClientEndpointBehavior();
        }
    }
}
